package com.crm.util;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.crm.pojo.common.PageResult;
import com.crm.pojo.common.Result;

import java.util.List;

/**
 * @Author: xaw
 * @CreateTime: 2025-09-04  15:13:30
 * @Description:
 * @Version: 1.0
 */
public class PageInfo extends PageResult {


    public static PageResult getPageResult(IPage pageInfo) {
        PageResult pageResult = new PageResult();
        pageResult.setTotal(pageInfo.getTotal());
        pageResult.setRows(pageInfo.getRecords());
        pageResult.setCode(200);
        pageResult.setMsg("查询成功");
        return pageResult;
    }

    public static PageResult getPageResult(Page pageInfo, List list) {
        PageResult pageResult = new PageResult();
        pageResult.setTotal(pageInfo.getTotal());
        pageResult.setRows(list);
        pageResult.setCode(200);
        pageResult.setMsg("查询成功");
        return pageResult;
    }

}
